<?php

class DefaultController extends Controller
{
	public function actionIndex()
	{
		$model = Main::model()->find();
        $news = News::model()->findAll(array(
            'condition'=>'is_visible=:visible',
            'params'=>array(':visible'=>true),

            'limit'=>3,
            'order'=>'created_at DESC',
        ));
        $articles = Article::model()->findAll(array(
            'condition'=>'is_visible=:visible',
            'params'=>array(':visible'=>true),

            'limit'=>3,
            'order'=>'created_at DESC',
        ));
        $this->render('index', array(
            'model' => $model,
            'news'=>$news,
            'articles'=>$articles
        ));
	}
}